package com.study.selection.service;

import com.study.selection.dao.TeacheringDao;
import com.study.selection.model.Teachering;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TeacheringServiceImpl implements TeacheringService {

    @Autowired
    private TeacheringDao teacheringDao;

    @Override
    public List<Teachering> findAll() { return teacheringDao.findAll(); }

    @Override
    public List<Teachering> findByKey(String key) {
        return teacheringDao.findByKey(key);
    }

    @Override
    public boolean addTeachering(Teachering teachering) {
        return teacheringDao.addTeachering(teachering) > 0 ? true : false;
    }

    @Override
    public Teachering getByTeacheringId(int teacheringId) {
        return teacheringDao.getByTeacheringId(teacheringId);
    }
    @Override
    public List<Teachering>getByCourseId(int courseId){
        return teacheringDao.getByCourseId(courseId);
    }

    @Override
    public List<Teachering>getByTeacherId(int teacherId){
        return teacheringDao.getByTeacherId(teacherId);
    }

    @Override
    public boolean updateTeachering(Teachering teachering) {
        return teacheringDao.updateTeachering(teachering) > 0 ? true : false;
    }
    @Override
    public boolean deleteTeachering(int teacheringId) {
        return teacheringDao.deleteTeachering(teacheringId) > 0 ? true : false;
    }


}
